package com.urguxxi.springdemo.config;


import com.urguxxi.springdemo.interceptor.LoginInterceptor;
import org.omg.PortableInterceptor.Interceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SystemConfig implements WebMvcConfigurer {
    /**
     * Register a interceptor
     * 注册一个拦截器
     */
    public void addInterceptor(InterceptorRegistry registry){
        registry.addInterceptor(new LoginInterceptor())
                //表示拦截所有请求
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**");
    }

}
